package com.acceptable.qucun.user.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 
 * </p>
 *
 * @author 巴斯罗斯·K·赫斯洛利
 * @since 2021-08-29
 */
@TableName("user")
public class User extends Model<User> {

    private static final long serialVersionUID=1L;

    /**
     * 用户唯一id 不用于登录
     */
   @TableId(value = "user_id", type = IdType.INPUT)
    private Integer userId;

    /**
     * 用户绑定的邮箱 用于登录
     */
    @TableField("email")
    private String email;

    /**
     * 用户昵称
     */
    @TableField("nickname")
    private String nickname;

    /**
     * 用户密码, Base64加密 密文存储
     */
    @TableField("password")
    private String password;

    @TableField("delete_time")
    private LocalDateTime deleteTime;

    private String deleteTimeStr;

    /**
     * 用户根目录
     */
    @TableField("server_root")
    private String serverRoot;

    /**
     * 用户总容量 单位MB
     */
    @TableField("total_volume")
    private Long totalVolume;

    /**
     * 用户版本号
     */
    @TableField("version")
    @Version
    private Integer version;

    /**
     * 该账户是否被回收
     */
    @TableField("is_deleted")
    @TableLogic
    private Boolean deleted = false;

    @TableField("head_path")
    private String headPath = "";

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getServerRoot() {
        return serverRoot;
    }

    public void setServerRoot(String serverRoot) {
        this.serverRoot = serverRoot;
    }

    public Long getTotalVolume() {
        return totalVolume;
    }

    public void setTotalVolume(Long totalVolume) {
        this.totalVolume = totalVolume;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Boolean getDeleted() {
        return deleted;
    }

    public void setDeleted(Boolean isDeleted) {
        this.deleted = isDeleted;
    }

    public LocalDateTime getDeleteTime() {
        return deleteTime;
    }

    public void setDeleteTime(LocalDateTime deleteTime) {
        this.deleteTime = deleteTime;
    }

    public String getDeleteTimeStr() {
        return deleteTimeStr;
    }

    public void setDeleteTimeStr(String deleteTimeStr) {
        this.deleteTimeStr = deleteTimeStr;
    }

    public String getHeadPath() {
        return headPath;
    }

    public void setHeadPath(String headPath) {
        this.headPath = headPath;
    }

    @Override
    protected Serializable pkVal() {
        return this.userId;
    }

    @Override
    public String toString() {
        return "User{" +
                "userId=" + userId +
                ", email='" + email + '\'' +
                ", nickname='" + nickname + '\'' +
                ", password='" + password + '\'' +
                ", deleteTime=" + deleteTime +
                ", serverRoot='" + serverRoot + '\'' +
                ", totalVolume=" + totalVolume +
                ", version=" + version +
                ", isDeleted=" + deleted +
                ", headPath='" + headPath + '\'' +
                '}';
    }
}
